package su.storage.dto;

import org.apache.commons.lang.StringUtils;

import su.storage.entity.StorageMaterial;
import su.tool.SuDateUtils;
import su.tool.SuDoubleUtils;
import su.tool.SuIntUtils;


public class StorageMaterialDto {

	/* ID */
	private String  id;
			
	/* 仓库号 */
	private String  storage;
			
	/* 原料id */
	private String  materialid;
			
	/* 出入库时间 */
	private String  flowtime;
			
	/* 库存流向，1入库，2出库 */
	private String  flowtype;
			
	/* 数量 */
	private String  flownum;
			
	/* 当前余量 */
	private String  total;
			
	/* 供货商id */
	private String  ghsid;
			
	/* 单价 */
	private String  price;
			
	/* 描述 */
	private String  sdesc;
			
	/* 状态，1有效，0删除 */
	private String  status;
			
	/* 出库去向 */
	private String  outtype;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getStorage() {
		return storage;
	}

	public void setStorage(String storage) {
		this.storage = storage;
	}

	public String getMaterialid() {
		return materialid;
	}

	public void setMaterialid(String materialid) {
		this.materialid = materialid;
	}

	public String getFlowtime() {
		return flowtime;
	}

	public void setFlowtime(String flowtime) {
		this.flowtime = flowtime;
	}

	public String getFlowtype() {
		return flowtype;
	}

	public void setFlowtype(String flowtype) {
		this.flowtype = flowtype;
	}

	public String getFlownum() {
		return flownum;
	}

	public void setFlownum(String flownum) {
		this.flownum = flownum;
	}

	public String getTotal() {
		return total;
	}

	public void setTotal(String total) {
		this.total = total;
	}

	public String getGhsid() {
		return ghsid;
	}

	public void setGhsid(String ghsid) {
		this.ghsid = ghsid;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	public String getSdesc() {
		return sdesc;
	}

	public void setSdesc(String sdesc) {
		this.sdesc = sdesc;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getOuttype() {
		return outtype;
	}

	public void setOuttype(String outtype) {
		this.outtype = outtype;
	}
	/**
	 * 从页面获取的数据转化为entity的值
	 * @return
	 */
	public StorageMaterial toEntity(){
		StorageMaterial sm = new StorageMaterial();
		sm.setId(SuIntUtils.getInt(this.id));
		sm.setMaterialid(SuIntUtils.getInt(this.materialid));
		sm.setFlowtype(SuIntUtils.getInt(this.flowtype));
		sm.setFlowtime(SuDateUtils.getDateByFormatString(this.flowtime, "yyyy-MM-dd"));
		sm.setFlownum(SuDoubleUtils.getDoubleFromObj(this.flownum));
		sm.setGhsid(SuIntUtils.getInt(this.ghsid));
		sm.setPrice(SuDoubleUtils.getDoubleFromObj(this.price));
		sm.setSdesc(this.sdesc);
		return sm;
	}
	
}
